package webBeans;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import dto.BookingDTO;
import dto.UserDTO;
import beansInterfaces.BookingMgr;
import beansInterfaces.UserMgr;

@ManagedBean(name = "userBean")
@RequestScoped
public class UserBean{


	@EJB
	private UserMgr userManager;
	@EJB
	private BookingMgr bookingManager;
	
	private List<BookingDTO> bookings;
	
	private String editor;
	
	public UserBean(){
	
	}
	public String name(){
		return userManager.getUserDTO().getUsername();
	}
	
	@PostConstruct
	public void personalBookings(){
		bookings = bookingManager.getUserBookingsDTO(name());
	}
	public List<BookingDTO> getBookings() {
		return bookings;
	}
	public void setBookings(List<BookingDTO> bookings) {
		this.bookings = bookings;
	}
	public String getEditor() {
		return editor;
	}
	public void setEditor(String editor) {
		this.editor = editor;
	}

	
	
}
